<template>
  <div>
    <el-card>
      <el-form ref="shopQueryList" :inline="true">
        <el-form-item label="素材名称">
          <el-input v-model="shopQueryList.shopName" placeholder="请输入素材" />
        </el-form-item>
        <el-form-item label="素材类别">
          <el-select v-model="form.region" placeholder="请选择">
            <el-option label="区域一" value="shanghai" />
            <el-option label="区域二" value="beijing" />
          </el-select>
        </el-form-item>
        <el-form-item label="上传者">
          <el-select v-model="form.region" placeholder="请选择">
            <el-option label="区域一" value="shanghai" />
            <el-option label="区域二" value="beijing" />
          </el-select>
        </el-form-item>
      </el-form>
      <el-row type="flex" justify="end" :gutter="20">
        <el-button type="primary">查询</el-button>
        <el-button>重置</el-button>
        <el-link type="primary">展开</el-link>
      </el-row>
      <el-button type="primary" @click="goAdd">上传</el-button>
      <el-table
        :data="tableData"
        style="width: 100%"
      >
        <el-table-column
          prop="materialName"
          label="素材名"
          width="180"
        />
        <el-table-column
          prop="materiaImg"
          label="素材图"
          width="180"
        />
        <el-table-column
          prop="materiaType"
          label="类别"
        />
        <el-table-column
          prop="uploaderName"
          label="上传者名称"
        />
        <el-table-column
          prop="phone"
          label="联系方式"
        />
        <el-table-column
          prop="time"
          label="提审日期"
        />
        <el-table-column
          prop="state"
          label="审核状态"
        />
        <el-table-column
          prop="postscript"
          label="备注信息"
        />
        <el-table-column label="操作">
          <el-button type="text" @click="dialogVisible = true">审核</el-button>
          <el-button type="danger" size="mini">删除</el-button>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination
          :current-page="currentPage4"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="400"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
    >
      <span>上传</span>
      <el-alert
        title="通过的素材审核"
        type="info"
        show-icon
      />
      <el-form>
        <el-form-item label="备注说明">
          <el-input v-model="form.desc" type="textarea" />
        </el-form-item>
      </el-form>
      <span
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { getMaterialList } from '@/api/discount.js'
export default {
  name: 'MaterialList',
  data() {
    return {
      currentPage4: 1,

      shopQueryList: {},
      form: {
        region: ''
      },
      tableData: [{
        date: '1', // 素材名
        name: '1', // 素材图
        address: '1', // 类别
        uploader: '1', // 上传者名称
        Way: '1', // 联系方式
        Tdata: '1', // 提审日期
        state: '1', // 审核转态
        postscript: '1'// 备注信息
      }]
    }
  }, created() {
    this.getMaterialList()
  },
  goAdd() {
    this.dialogVisible = true
  },
  methods: {
    handleSizeChange() {},
    handleCurrentChange() {},
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => {})
    },
    async getMaterialList() {
      const res = await getMaterialList()
      this.tableData = res.data.data
      console.log(this.tableData)
    }
  }
}
</script>

<style lang="less" scoped>
  .el-row {
    margin-bottom: 20px;}
    .block{
      margin-top: 20px;
      display: flex;
      justify-content: space-evenly;
    }
    </style>
